<?php 
  require(dirname(__FILE__)."/global.php");
  require(ROOT."/admin/isLogin.php");
  
  $submit = $_POST['submit'];
  if(isset($submit))
  {
      $ids = $_POST['groupid'];
      $allowPosts = $_POST['allowPost'];
      $allowReplys = $_POST['allowReply'];
      $allowWatchAttachs = $_POST['allowWatchAttach'];
                                                                                                                                                                 
      for($i = 0;$i < count($ids);$i++){
          $sql = "update talking_group set GroupAllowPost='".$allowPosts[$i]."',GroupAllowReply='".$allowReplys[$i]."',GroupAllowWatchAttach='".$allowWatchAttachs[$i]."' where GroupID=".$ids[$i];
          $db->execute($sql);
      }
      $smarty->assign('tip','更新成功'); 
  }
  $sql = "select * from talking_group order by GroupID";
  $groups = $db->query($sql);
  $smarty->assign('groups',$groups);
  $smarty->display("user_group.html");
  $db->close();                                   
?>
